package Algorithms.jishi.niuke.huawei;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * description: <br>
 * createTime: 2020/11/1616:03 <br>
 *
 * @author zzh
 */
public class TestEgypt {

    public static Fraction parse(String str) {
        String[] array = str.split("/");
        return new Fraction(Integer.parseInt(array[0]), Integer.parseInt(array[1]));
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        Fraction inputFenshu = parse(str);

        List<Fraction> result = getResult(inputFenshu);
        StringBuilder sb = new StringBuilder();
        for (Fraction fenShu : result) {
            sb.append(fenShu.toString()).append('+');
        }
        sb.deleteCharAt(sb.length() - 1);
        System.out.println(sb.toString());
    }


    private static List<Fraction> getResult(Fraction inputFenshu) {
        List<Fraction> result = new ArrayList<>();
        getResultRecurse(result, inputFenshu);
        return result;
    }


    private static void getResultRecurse(List<Fraction> result, Fraction fenShu) {
        int son = fenShu.getSon();
        int mother = fenShu.getMother();
        if(son == 1) {
            result.add(fenShu);
            return;
        }
        if(mother % son == 0) {
            result.add(new Fraction(1, mother / son));
            return;
        }
        int temp = (int) Math.ceil(mother * 1.0 / son * 1.0);
        int newMother = temp * mother;
        int newSon = son * temp - mother;
        result.add(new Fraction(1, temp));
        getResultRecurse(result, new Fraction(newSon, newMother));
    }


    @Data
    @AllArgsConstructor
    static class Fraction {
        private int son;
        private int mother;


        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder();
            sb.append(son);
            sb.append('/');
            sb.append(mother);
            return sb.toString();
        }
    }
}
